<?php


namespace App\Http\Services\FormBuilder\Segments;


use App\Http\Services\FormBuilder\Elements\FormControl;
use App\Http\Services\FormBuilder\Elements\Hidden;
use App\Http\Services\FormBuilder\Traits\MoneySelectorTrait;
use Illuminate\Support\Collection;

class QuotaDonate extends FormControl
{
    use MoneySelectorTrait;
    private $money;
    private $quotaDonateName;

    public function __construct($name, Collection $data)
    {
        parent::__construct($name);

        $this->name = $name;
        $this->data = $data;
    }

    public function render()
    {
        $html = $this->quotaDonateName . '：<span>' . $this->money . '</span> ' . $this->unit;
        $html .= (new Hidden($this->name))->value($this->money);

        return $html;
    }

    public function setMoney($money)
    {
        $this->money = $money;

        return $this;
    }


    public function setQuotaDonateName($quotaDonateName)
    {
        $this->quotaDonateName = $quotaDonateName;

        return $this;
    }

}